Crate tungstenite

source ·
Expand description

Lightweight, flexible WebSockets for Rust.

Re-exports

pub use http;
pub use crate::error::Error;
pub use crate::error::Result;
pub use crate::protocol::WebSocket;
pub use crate::client::client;
pub use crate::client::connect;
pub use crate::handshake::client::ClientHandshake;
pub use crate::handshake::server::ServerHandshake;
pub use crate::handshake::HandshakeError;

Modules

A buffer for reading data from the network.
Methods to connect to a WebSocket as a client.
Error handling.
WebSocket handshake control.
Generic WebSocket message stream.
Convenience wrapper for streams to switch between plain TCP and TLS at runtime.
Helper traits to ease non-blocking handling.

Enums

A connector that can be used when establishing connections, allowing to control whether native-tls or rustls is used to create a TLS connection. Or TLS can be disabled with the Plain variant.
An enum representing the various forms of a WebSocket message.

Functions

Accept the given Stream as a WebSocket.
Accept the given Stream as a WebSocket.
Accept the given Stream as a WebSocket.
Accept the given Stream as a WebSocket.
Creates a WebSocket handshake from a request and a stream, upgrading the stream to TLS if required.
The same as client_tls() but one can specify a websocket configuration, and an optional connector. If no connector is specified, a default one will be created.